package CutLoad.components.container.states
{
	import CutLoad.Base;
	import CutLoad.CutLoad;
	import CutLoad.ModuleBase;
	
	import flash.events.Event;
	
	/**
	 * 状态容器元素
	 * @author smallerbird mail:smallerbird@gmail.com  site:www.mkigm.com QQ群:49983196
	 * 
	 */	
	public class StatesItem extends Base
	{
		private var isAddStage:Boolean=false;
		public function StatesItem():void{
			this.addEventListener(Event.ADDED_TO_STAGE,init_super);
		}
		protected function init_super(e:Event):void{
			this.isAddStage=true;
		}
		/**
		 * 进入该状态时调用 
		 * 
		 */		
		public function main():void{
			
		}
		/**
		 * 离开该状态时调用
		 * 
		 */		
		override public function killMe():void{
			
		}
		/**
		 * 获得它父类(States对象)
		 * @return 
		 * 
		 */		
		public function getStates():States{
			if(!isAddStage) throw new Error("还没有放到stage里");
			if(this.parent==null) return null;
			return this.parent as States;
		}		
	}
}